const components = require.context('../components', true, /\.vue$/)
const pages = require.context('../pages', true, /\.vue$/)

const $components = []

components.keys().forEach((key) => {
  let component = components(key).default || components(key)
  $components.push(component)
})
pages.keys().forEach((key) => {
  let component = pages(key).default || pages(key)
  $components.push(component)
})

const install = function (Vue, option) {
  $components.map((component) => {
    Vue.component(component.name, component)
    // exp[component.name] = component
  })
}

let exp = {}

exp.install = install

export default exp
